<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <!-- jQuery文件。务必在bootstrap.min.js之前引入 -->
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>

    <link rel="stylesheet" href="__SITE__/static/index/css/home1.css" />

</head>
<body>

<section class="sectionContent">
    <div class="title-div">
        <span class="title-span">赛事报名确认</span>
    </div>
    <div class="div1">
        <span class="span1">曲目</span>
        <div class="div2">

        </div>
        <div class="div3">
            <span >*</span>
            <input class="inputclass" type="text" name="name" size="12" placeholder="请输入..."  id="song">
        </div>

    </div>
    <!--<div class="div1">-->
        <!--<span class="span1">组别</span>-->
        <!--<div class="div2">-->

        <!--</div>-->
        <!--<div class="div3">-->
            <!--<span >*</span>-->
            <!--<input class="inputclass" type="text" name="name" size="12" placeholder="请输入..."  id="grp">-->
        <!--</div>-->

    <!--</div>-->
    <div class="div1">
        <span class="span1">选手姓名</span>
        <div class="div2">

        </div>
        <div class="div3">
            <span >*</span>
            <input class="inputclass" type="text" name="name" size="12" placeholder="请输入..."  id="player">
        </div>

    </div>
    <div class="div1">
        <span class="span1">联系方式</span>
        <div class="div2">

        </div>
        <div class="div3">
            <span >*</span>
            <input class="inputclass" type="text" name="name" size="12" placeholder="请输入..."  id="phone">
        </div>

    </div>

    <div class="div1">
        <span class="span1">组别</span>
        <div class="div2">

        </div>
        <div class="div3">
            <span >*</span>

            <select id="grp" style="width: 90%;font-size: large;">
                <option value="0">-- 请选择相应分组--</option>
                <option>幼儿组</option>
                <option>儿童组</option>
                <option>少年组</option>
            </select>
        </div>

    </div>


    <div class="button-div">
        <button class="button-submit" id="true">提交</button>

    </div>
</section>

<div class="pop-bg flex v-center">
    <div class="pop">
        <br />
        <div style="color: black;font-size: x-large;" id="suc">报名成功!</div>
        <br /><br />
        <button class="button-ok">确认</button>
    </div>
</div>

<div class="pop-bg1 flex1 v-center1">
    <div class="pop1">
        <br />
        <div style="color: black;font-size: x-large;">您已报名!</div>
        <br /><br />
        <button class="button-ok1">确认</button>
    </div>
</div>

<script>
    $(function () {
        $("#true").click(function () {
            if(checksong() && checkgrp() && checkplayer() && checkphone()) {
                var song = $("#song").val();
                var grp = $("#grp").val();
                var player = $("#player").val();
                var phone = $("#phone").val();
                $.ajax({
                    url:"{:url('Index/handleSign')}",
                    data:{song:song,grp:grp,player:player,phone:phone},
                    type:'POST',
                    dataType:'json',
                    success:function (data) {
                        if(data.flag == 0) {
                            $("#suc").html(data.data.id+'号选手'+'&nbsp;'+data.data.player);
                            $(".pop-bg").css('visibility','visible');
                        }
                        if(data.flag == 1) {
                            $(".pop-bg1").css('visibility','visible');
                        }
                    }
                });
            }
        });
        $(".button-ok").click(function () {
            $(".pop-bg").css('visibility','hidden');
            window.location.href = "__SITE__/index/Index/applywin";
        });

        $(".button-ok1").click(function () {
            $(".pop-bg").css('visibility','hidden');
            window.location.reload();
        });

        function checksong()
        {
            var song = $("#song").val();
            if(!song) {
                return false;
            }else {
                return true;
            }
        }

        function checkgrp()
        {
            var grp = $("#grp").val();
            if(grp == 0) {
                return false;
            }else {
                return true;
            }
        }

        function checkplayer()
        {
            var player = $("#player").val();
            if(!player) {
                return false;
            }else {
                return true;
            }
        }

        function checkphone()
        {
            var phone = $("#phone").val();
            if(!phone) {
                return false;
            }else {
                return true;
            }
        }
    })
</script>
</body>
</html>
